package com.getword.web.controller;


import com.getword.service.FollowService;
import com.getword.web.model.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/follow")
public class ApiFollowController {
    @Autowired
    private FollowService followService;

    @GetMapping("/state")
    public Result getFollowState(Long userId){
        return followService.getFollowState(userId);
    }

    @PostMapping()
    public Result follow(Long userId){
        return followService.followAuthor(userId);
    }

    @DeleteMapping
    public Result cancel(Long userId){
        return followService.cancelFollow(userId);
    }
}
